package com.jmhan.cloud.mycatapp;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.mhgis.dog.server.Dog;
import com.mhgis.dog.server.DogService;

@RestController
public class MycatController {

	 @Autowired(required=true)
	  private DogService dogService;

	  @RequestMapping("/findall")
	  public void testFindAll() {
		  dogService.findAll().forEach(dog -> System.out.println(dog.toString()));
	  }

	  @RequestMapping("/save")
	  public void testSave(){
	    Dog dog = new Dog();

	    
	   dog.setId(dogService.getNewID());
	   dog.setName("ssss");
	   dogService.save(dog);
	  }
	
}
